#lang r5rs
(define (equals? a b)
  (cond ((pair? a)
        (if (eq? (pair? a) (pair? b))
            (and (eq? (car a) (car b)) (equal? (cdr a) (cdr b)))
            #f))
        ((null? a)
         (if (eq? (null? a) (null? b))
             #t
             #f))
        (else (eq? a b))))
